package Source;

import DAO.MySQLAccountDAO;
import Types.AccountType;
import Views.MainUI;

/**
 * The model for deleteuser
 * @author Josh
 */
public class DeleteUser {

    private AccountType account;
    private MySQLAccountDAO accountCon = new MySQLAccountDAO();

    /**
     * Checks if the password entered matched the database
     * @param password
     * @return boolean
     */
    public boolean confirmPassword(String password) {
        account = MainUI.getOnlineUser();
        if (account.getPassword().toUpperCase().equals(password.toUpperCase())) {
            return true;
        } else {
            return false;
        }

    }

    /**
     * Calls the dao to delete the user from the database
     * @return boolean
     */
    public boolean deleteUser() {
        return accountCon.deleteAccount(account.getUsername());
    }
}
